/*-------------------------------------------------------------------------

***************** Modification History ***********************************
   @doc
   @module list.h - Header files for Functions used to display tables in setup |
   @end
   
$Log: /SoftPay/SPK2SIM/Source/Include/list.h $ 
 * 
 * 4     2/21/00 3:00p Jim_b4
 * Include file restructuring
 * 
 * 3     11/23/99 9:44a Jim_b4
 * Prototype cleanup in Scalls and beyond plus fix to menufuncs
 * 
 * 2     11/10/99 11:00a Monique_b1
 * Modified various functions due to the change in the field def
 * structure. removed the Ftag flag which identified the SKE file and all
 * references to SKE.
 * 
 * 1     7/19/99 5:45p Jim_b4
 * 
 * 1     7/19/99 4:31p Jim_b4
 * 
 * 2     6/09/99 11:22a Monique_b1
 * Change headers and file names for SP 2000
**************************************************************************

   Copyright (C) 1999 by VeriFone, Inc.

   All rights reserved.  No part of this software may be reproduced,
   transmitted, transcribed, stored in a retrieval system, or translated
   into any language or computer language, in any form or by any means,
   electronic, mechanical, magnetic, optical, chemical, manual or otherwise,
   without the prior written permission of VeriFone, Inc.

---------------------------------------------------------------------------*/
#ifndef VSLIST_H
#define VSLIST_H

#include <scalls.h>

#define	LIST_SIGNATURE	0x4C49
#define	NODE_SIGNATURE	0x4E4F

typedef	struct  Node
{
	struct	Node	*pndPreviousNode;
	struct	Node	*pndNextNode;
	int				inNodeSig;
}	Node;

typedef	struct	List
{
	struct	Node	*pndHead;
	struct	Node	*pndTail;
	int				inListSig;
}	List;

typedef struct  RecordList
{
		List		    liListInfo;
		char		    pszFileName[FILENAME_SIZE + 1];
		int			    inRecordSize;
		int			    inNumberOfRecords;
		char		    *pchRecordPtr;
		long		    lnRecordPosition;
		FieldDefinition	*psrFieldDefinitionPtr;
		int			    inTitleFieldIndex;
}	RecordList;

typedef	struct  RecordNode
{
	Node		ndData;
	int			inRecordIndex;
}	RecordNode;


typedef	struct  FieldList
{
	List		liListInfo;
	RecordList	*prlParentRecord;
	int			inRecordNumber;
}	FieldList;

typedef	struct  FieldNode
{
	Node		ndData;
	int			inFieldIndex;
}	FieldNode;


//#define	fValidList(a)	(((List *)(a))->inListSig == LIST_SIGNATURE)
//#define	fValidNode(a)	(((Node *)(a))->inNodeSig == NODE_SIGNATURE)

VS_BOOL fValidList(List *pliList);
VS_BOOL fValidNode(Node *pndNode);

typedef  void (*PFVD_RL_RN)(RecordList *, RecordNode *);
typedef  void (*PFVD_FL_FN)(FieldList *, FieldNode *);

int inSelectNode (RecordList *pliListOfChoices, Node **ppndSelectedNode, PFVD_RL_RN pfnDisplayNode);
int inSelectEditNode (RecordList *pliListOfChoices, Node **ppndSelectedNode, PFVD_FL_FN pfnDisplayNode);
List *pliCreateList(long lnListSize);
void vdDestroyListAndNodes(List *pliObsoleteList);
Node *pndListStart(List *pliList);
Node *pndListEnd(List *pliList);
int inAddToListStart (List *pliTown, Node *pndNewKid);
int inAddToListEnd(List *pliTown, Node *pndNewKid);
int inNumberOfNodes(List *pliList);
Node *pndCreateNode(long lnNodeSize);
void vdDestroyNode(Node *pndObsoleteNode);
Node *pndPreviousNode(Node *pndCurrentNode);
Node *pndNextNode(Node *pndCurrentNode);


#endif /* VSLIST_H */

